
/**
 * 用于替换字符串中间的占位符
 * @returns {String}
 */
String.prototype.formatVueText = function() {
  if(arguments.length == 0) return this;
  var param = arguments[0];
  var s = this;
  if(typeof(param) == 'object') {
    for(var key in param)
      s = s.replace(new RegExp("\\{" + key + "\\}", "g"), param[key]);
    return s;
  } else {
    for(var i = 0; i < arguments.length; i++)
      s = s.replace(new RegExp("\\{" + i + "\\}", "g"), arguments[i]);
    return s;
  }
}

if (!String.prototype.trim){
  /*---------------------------------------
   * 清除字符串两端空格，包含换行符、制表符
   *---------------------------------------*/
  String.prototype.trim = function () {
    return this.replace(/(^[\s\n\t]+|[\s\n\t]+$)/g, "");
  }
}
